//headers 
#include<algorithm>
#include<cassert>
#include<cstdio>
#include<deque>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<deque>
#include<set>
#include<string>
#include<sstream>
#include<stack>
#include<streambuf>
#include<vector>
using namespace std;

//macros
#define LET(x,a) typeof(a) x(a)
#define FOR(i,a,n) for(LET(i,a);i!=n;i++)
#define REP(i,n) FOR(i,0,n)
#define sz size()
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define PRINT(x) REP(_,x.sz) cout<<x[_]<<" "; cout<<endl;
const int INF = (int) 1e8;
#define VI vector<int>
#define VS vector<string>
#define VVI vector< vector<int> >
#define PII pair<int,int>
#define VII vector< PII >
#define LL long long
#define mp make_pair


//code of suren

struct slope{
  int sign;
  double slope;
};

vector< pair<int,int> > points;
slope sl ; 


int go(int pt){
  PII pt1,pt2; pt1 = points[pt]; pt2 = points[(pt+1)%points.sz];
  slope sl2;

  double b = pt2.second - pt1.second;
  double a = pt2.first - pt1.first;
  
  if(!b) { if(a>0) sl2.sign=1; else sl2.sign=-1; sl2.slope = 1 << 30; }
  else { sl2.sign = (a*b)>0 ? 1 : -1; sl2.slope = a/b; }
  
  if( sl.sign == sl2.sign && sl.slope == sl2.slope)  return 0; 
  else sl=sl2;
  return 1;
  
}

int main(){
  int n; int ans; 
  while( cin>>n , n ){
    ans = 0;
    points.clear(); points.resize(n);
    REP(i,n) cin>>points[i].first>>points[i].second;

    double b = points[1].second - points[0].second;
    double a = points[1].first - points[0].first;
    
    if(!b) { if(a>0) sl.sign=1; else sl.sign=-1; sl.slope = 1 << 30; }
    else { sl.sign = (a*b)>0 ? 1 : -1; sl.slope = a/b; }

    FOR(i,1,n) ans+=go(i);
    cout<<ans<<endl;
  }
  
  return 0;
}
